/*
 * Copyright 2012-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.cloudshadow.platform.server;

import com.google.common.base.Predicates;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
//@EnableFeignClients
//@EnableEurekaClient
//@EnableHystrix
@EnableSwagger2
//@EnableCircuitBreaker
public class Application {

//    @Bean
//    public Retryer retryer(){
//        return Retryer.NEVER_RETRY;
//    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(Application.class, args);
    }


//    @Bean
//    public Docket testApi() {
//        @SuppressWarnings("unchecked")
//        Docket docket = new Docket(DocumentationType.SWAGGER_2).groupName("test")
//                .genericModelSubstitutes(DeferredResult.class).useDefaultResponseMessages(false).forCodeGeneration(true)
//                .pathMapping("/")// base，最终调用接口后会和paths拼接在一起
//                .select()
//                .paths(Predicates.or(
//                        PathSelectors.regex( "/user" + ".*"),
//                        PathSelectors.regex( "/demo" + ".*")
//                ))// 过滤的接口
//                .build().apiInfo(testApiInfo());
//        return docket;
//    }
//
//    private ApiInfo testApiInfo() {
//        ApiInfo apiInfo = new ApiInfo("Test相关接口", // 大标题
//                "Test相关接口，主要用于测试.", // 小标题
//                "1.0", // 版本
//                "", "", // 作者
//                "", // 链接显示文字
//                ""// 网站链接
//        );
//
//        return apiInfo;
//    }
}
